Source File
xmlnode.go
Belonging Package
github.com/ChrisTrenkamp/goxpath/tree/xmltree/xmlnode
package xmlnode
import (
)
//XMLNode will represent an attribute, character data, comment, or processing instruction node
type XMLNode struct {
xml.Token
tree.NodePos
tree.NodeType
Parent tree.Elem
}
//GetToken returns the xml.Token representation of the node
func ( XMLNode) () xml.Token {
if .NodeType == tree.NtAttr {
:= .Token.(*xml.Attr)
return *
}
return .Token
}
//GetParent returns the parent node
func ( XMLNode) () tree.Elem {
return .Parent
}
//ResValue returns the string value of the attribute
func ( XMLNode) () string {
switch .NodeType {
case tree.NtAttr:
return .Token.(*xml.Attr).Value
case tree.NtChd:
return string(.Token.(xml.CharData))
case tree.NtComm:
return string(.Token.(xml.Comment))
}
//case tree.NtPi:
return string(.Token.(xml.ProcInst).Inst)
}
![]() |
The pages are generated with Golds v0.6.7. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |